import React, { useState, useCallback } from 'react'

const s = new Set();

function UseCallBack() {
    const [num, setNum] = useState(0);
    const increment = useCallback(() => {
        setNum(num => num + 1)
    }, [])
    s.add(increment)
    console.log(s.size)
    return (
        <div className="container">
            <h4 className='display-4'>{num}</h4>
            <button onClick={increment} className='btn btn-primary'>增加</button>
        </div>
    )
}

export default UseCallBack